1 /* JJT: 0.2.2 */
2
3 package mobisnap.mobile_trx;
4
5 /***
6 * Implements relational expression
7 */
8 public class ASTPlSqlRelationalExpression extends mobisnap.mobile_trx.SimpleNode {
9 public ASTPlSqlSimpleExpression first;
10 public byte type = 0;
11 public Object v1, v2;
12
13
14 public ASTPlSqlRelationalExpression(int id) {
15 super(id);
16 }
17
18 public ASTPlSqlRelationalExpression( MobisnapSQL p, int i) {
19 super( p, i);
20 id = i;
21 }
22
23 /*** Accept the visitor. **/
24 public Object jjtAccept(MobisnapSQLVisitor visitor, Object data) {
25 return visitor.visit(this, data);
26 }
27
28 /***
29 * Returns the value of the expression
30 *
31 * @param msql_type Specifies which type of processing should be performed
32 * MobisnapConstants.MSQL_SERVER = 1
33 * MobisnapConstants.MSQL_TENTATIVE_CLIENT = 2
34 * MobisnapConstants.MSQL_STABLE_CLIENT = 3
35 * MobisnapConstants.MSQL_RESERVATION_CLIENT = 4
36 * @param cond True if reservations associated iwth transaction should be
37 * propagated to the current transaction
38 */
39 public Object value( int msql_type, boolean cond) throws Exception {
40 switch( type) {
41 case 0:
42 return first.value( msql_type, cond);
43 case 1:
44 ASTRelop op = (ASTRelop)v1;
45 switch( op.type) {
46 case ASTRelop.OP_EQUAL:
47 return MSQLTypeUtil.equal( first.value( msql_type, cond), ((ASTPlSqlSimpleExpression)v2).value( msql_type, cond));
48 case ASTRelop.OP_NOTEQUAL:
49 return MSQLTypeUtil.notEqual( first.value( msql_type, cond), ((ASTPlSqlSimpleExpression)v2).value( msql_type, cond));
50 /* case ASTRelop.OP_CARDINAL:
51 return MSQLTypeUtil.cardinal( first.value( msql_type, cond), ((ASTPlSqlSimpleExpression)v2).value( msql_type, cond));
52 */ case ASTRelop.OP_MOREORLESS:
53 return MSQLTypeUtil.moreOrLess( first.value( msql_type, cond), ((ASTPlSqlSimpleExpression)v2).value( msql_type, cond));
54 case ASTRelop.OP_MORE:
55 return MSQLTypeUtil.more( first.value( msql_type, cond), ((ASTPlSqlSimpleExpression)v2).value( msql_type, cond));
56 case ASTRelop.OP_MOREEQUAL:
57 return MSQLTypeUtil.moreEqual( first.value( msql_type, cond), ((ASTPlSqlSimpleExpression)v2).value( msql_type, cond));
58 case ASTRelop.OP_LESS:
59 return MSQLTypeUtil.less( first.value( msql_type, cond), ((ASTPlSqlSimpleExpression)v2).value( msql_type, cond));
60 case ASTRelop.OP_LESSEQUAL:
61 return MSQLTypeUtil.lessEqual( first.value( msql_type, cond), ((ASTPlSqlSimpleExpression)v2).value( msql_type, cond));
62 default:
63 throw new mobisnap.MobisnapException( "Internal error 1 in relational expression");
64 }
65 default:
66 throw new mobisnap.MobisnapException( "Internal error 2 in relational expression");
67 }
68 }
69
70
71 }
This page was automatically generated by Maven